package com.example.wangzh.mytest;

import android.view.View;

import com.example.wangzh.mytest.base.BaseActivity;
import com.example.wangzh.mytest.databinding.ActivityViewTransformationTouchTestBinding;

public class ViewTransformationTouchTestActivity extends BaseActivity<ActivityViewTransformationTouchTestBinding> {
    @Override
    protected void initView() {
        mBinding.btnTranslate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBinding.view.setTranslationX(100);
                mBinding.view.setTranslationY(50);
            }
        });
        mBinding.btnScale.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBinding.view.setPivotX(0);
                mBinding.view.setPivotY(0);
                mBinding.view.setScaleX(2);
                mBinding.view.setScaleY(2);
            }
        });
        mBinding.btnRotate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBinding.view.setPivotX(100);
                mBinding.view.setPivotY(100);
                mBinding.view.setRotation(45);
            }
        });
        mBinding.btnReset.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mBinding.view.setPivotX(100);
                mBinding.view.setPivotY(100);
                mBinding.view.setRotation(0);
                mBinding.view.setPivotX(0);
                mBinding.view.setPivotX(0);
                mBinding.view.setScaleX(1);
                mBinding.view.setScaleY(1);
                mBinding.view.setTranslationX(0);
                mBinding.view.setTranslationY(0);
            }
        });
    }
}
